import { View } from "@tarojs/components";
import Taro from "@tarojs/taro";
import { Badge, Image } from "@taroify/core";
import { imgAddPrefix } from "@/utils";

interface BarCardProps {
  // 用户头像
  sectorUrl: string;
  kid: string;
  sectorName: string;
  size?: number;
}

export default ({ sectorUrl, kid, sectorName, size = 70 }: BarCardProps) => {
  return (
    <View
      onClick={() => Taro.navigateTo({ url: "/pages/bar/info?id=" + kid })}
      className="p-2 text-sm flex-col inline-flex justify-center items-center"
    >
      <Badge content={10}>
        <Image
          className="rounded-xl"
          style={{ width: size, height: size }}
          src={imgAddPrefix(sectorUrl)}
        />
      </Badge>
      <View style={{ width: size + 10 }} className="truncate mt-1 text-center">
        {sectorName}
      </View>
    </View>
  );
};
